<?php

use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\OssController;

$api = app('Dingo\Api\Routing\Router');


$api->version('v1', function($api){

    $api->group(['prefix'=>'auth'], function ($api){

        //注册
        $api->post('register', [RegisterController::class, 'store']);
        //登录
        $api->post('login', [LoginController::class, 'login']);

        //需要登录的路由
        $api->group(['middleware'=>'api.auth'], function ($api){
            //注销token
            $api->post('logout', [LoginController::class, 'logout']);
            //刷新token
            $api->post('refresh', [LoginController::class, 'refresh']);
            // 阿里云OSS
            $api->get('oss/token', [OssController::class, 'token']);
        });
    });
});
